#include "SFMLGameTime.h"


SFMLGameTime::SFMLGameTime(void) : m_deltaTime(0.0f){}

SFMLGameTime::~SFMLGameTime(void){}


void SFMLGameTime::update()
{
	m_totalTime = m_totalTimeClock.getElapsedTime();
	m_elapsedTime = m_elapsedTimeClock.restart();
	m_deltaTime = static_cast<float>(m_elapsedTime.asMilliseconds()) / 1000.0f;
	if (m_deltaTime > 0.3f)
		m_deltaTime = 0.0f;
}

float SFMLGameTime::getTotalTimeAsSeconds() const
{
	return m_totalTime.asSeconds();
}

int SFMLGameTime::getTotalTimeAsMilliseconds() const
{
	return m_totalTime.asMilliseconds();
}

long long SFMLGameTime::getTotalTimeAsMicroseconds() const
{
	return m_totalTime.asMicroseconds();
}

float SFMLGameTime::getElapsedTimeAsSeconds() const
{
	return m_elapsedTime.asSeconds();
}

int SFMLGameTime::getElapsedTimeAsMilliseconds() const
{
	return m_elapsedTime.asMilliseconds();
}

long long SFMLGameTime::getElapsedTimeAsMicroseconds() const
{
	return m_elapsedTime.asMicroseconds();
}

float SFMLGameTime::deltaTime() const
{
	return m_deltaTime;
}